About ORM diagrams

Show me an example

The ORM Diagram template in Microsoft Visio includes all the shapes you need to use the Object Role Modeling (ORM) method to capture business rules and design databases. ORM is a semantic modeling approach that describes the world in terms of objects and the roles they play.

For information about Object Role Modeling, see Conceptual Schema and Relational Database Design, 2nd edition, by Terry Halpin (WytLytPub, Bellevue WA, USA, 1999), and visit http://www.orm.net/, the official Web site for conceptual data modeling.

Create an ORM diagram


Create an ORM diagram

Show me an example

  1. On the File menu, point to New, point to Database, and then click ORM Diagram.

Click to show or hide information. Tip

Before creating an ORM diagram, organize your thoughts by writing down the information you want the database to include. Use simple sentences to describe the objects that exist, how they are identified, and what roles they play.

  2. Add and name an object type (entity).

Click to show or hide information. How?

  1. Drag an Entity shape (to symbolize an object type) from the ORM Diagram stencil onto the drawing page.
  2. While the shape is selected, type the entity type's name.
  3. Press ENTER, and then type the entity reference mode in brackets.

  3. Add and name a value type.

Click to show or hide information. How?

  1. Drag a Value shape from the ORM Diagram stencil onto the drawing page.
  2. While the shape is selected, type the value type's name.

  4. Indicate a subtype.

Click to show or hide information. How?

  1. Drag a Subtype Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the end point [image] to a connection point [image] on the subtype entity shape.

The end point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Glue the begin point [image] (the arrowhead end) to a connection point [image] on the other entity type.

  5. Do one of the following:

Click to show or hide information. Indicate a relationship, role, or fact between object types

  1. Drag a predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) from the ORM Diagram stencil onto the drawing page.

Use a predicate shape that contains enough role boxes to relate all of the object types (entity shapes) involved in the relationship. For example, use a Ternary shape to indicate relationships among three entities.

  2. Drag a Role Connector shape from the ORM Diagram stencil onto the drawing page.
  3. Glue the begin point [image] of the Role Connector shape to a connection point [image] on an object type (entity shape) for which you want to define a relationship.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  4. Glue the end point [image] of the Role Connector shape to the appropriate role box on the predicate shape (from step 1).
  5. Double-click the predicate shape. Place the insertion point between ellipses (or placeholders), and then type a name for the role an entity type plays.
  6. Repeat steps 2–5 for each entity for which you want to define a relationship.

Click to show or hide information. Indicate a relationship, role, or reference between an entity and a value

  1. Drag the Role Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the begin point [image] of the Role Connector shape to a connection point [image] on an entity type (entity shape) for which you want to define a relationship.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Drag a Binary or Vertical Binary shape from the ORM Diagram stencil onto the drawing page.
  4. Glue the end point [image] of the Role Connector shape to the end of the Binary or Vertical Binary shape.
  5. Double-click the Binary shape to edit the text. Place the insertion point between ellipses or placeholders, and then type a name for the role an entity plays.

Click to show or hide information. Tip

To move the ellipses and names on a Vertical Binary shape to the other side of the shape, right-click the shape, point to Shape, and then click Flip Horizontal.

  6. Show a nested object by creating an objectified predicate.

Click to show or hide information. How?

  1. On the Standard toolbar, click the Rectangle tool [image].
  2. Draw a rectangle around the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to identify as an objectified predicate.
  3. Right-click the rectangle, point to Shape, and click Send To Back.
  4. With the rectangle still selected, on the Format menu, click Corner Rounding, click the third option on the top row, and then click OK.

  7. Do one of the following:

Click to show or hide information. Indicate a mandatory role constraint

  1. Drag the Mand. Role Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the begin point with the black circle [image] to a connection point [image] on an object (entity shape).

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Glue the end point [image] of the Mand. Role Connector shape to a predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary).

Click to show or hide information. Indicate a uniqueness constraint

  1. Drag the Uniqueness Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape directly above or below the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to constrain.
  3. Drag one of the endpoints ( [image] or [image]) so that the arrow stretches across the appropriate role box on the predicate shape.

Click to show or hide information. Indicate a frequency constraint

  1. Drag the Frequency Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to constrain.
  3. With the shape selected, type the frequency you want.

Click to show or hide information. Indicate a set comparison or equality constraint

  1. Drag the Subset Constraint or Equality Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape between the predicate shapes (Unary, Binary, Vertical Binary, Ternary, or Quaternary) with roles you want to constrain.
  3. Glue the begin point [image] of the Subset Constraint or Equality Constraint shape to a connection point [image] on the appropriate role box on the predicate shape.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  4. Glue the end point [image] of the Subset Constraint or Equality Constraint shape to the appropriate role box of the other predicate shape.

Click to show or hide information. Indicate a ring constraint

  1. Drag the Ring Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) containing the two roles you want to constrain.
  3. Do one of the following:
  • If the two roles are part of a longer predicate, glue each endpoint ( [image] and [image]) of the Ring Constraint shape to one of the roles on the predicate shape.
  • If the two roles are a binary predicate, select the Ring Constraint shape, and then on the Format menu, click Line, in the Pattern list, click None, and then click OK.
  4. Right-click the Ring Constraint shape, and then click the type of ring constraint you want.

Click to show or hide information. Indicate an external constraint

  1. Drag an external constraint shape (Ext. Freq. Constraint, Ext. P Constraint, Ext. Mand. Constraint, or Ext. Uniq. Constraint) from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shapes representing the roles you want to constrain.
  3. From the ORM Diagram stencil, drag a Constraint Connector shape onto the drawing page.
  4. Glue the begin point [image] of the constraint connector shape to a connection point [image] on the external constraint shape.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  5. Glue the end point [image] of the constraint connector shape to the appropriate role box on the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary).
  6. To change the frequency for the external constraint shape (Ext. Freq. Constraint, Ext. P Constraint, Ext. Mand. Constraint, or Ext. Uniq. Constraint), select the shape, and then type the frequency you want.

  8. Save the diagram.


ORM diagram example

ORM diagram example


Create and name an object type (ORM diagram)

  1. Drag an Entity shape (to symbolize an object type) from the ORM Diagram stencil onto the drawing page.
  2. While the shape is selected, type the entity type's name.
  3. Press ENTER, and then type the entity reference mode in brackets.


Create and name a value type (ORM diagram)

  1. Drag a Value shape from the ORM Diagram stencil onto the drawing page.
  2. While the shape is selected, type the value type's name.


Indicate a subtype (ORM diagram)

  1. Drag a Subtype Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the end point [image] to a connection point [image] on the subtype entity shape.

The end point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Glue the begin point [image] (the arrowhead end) to a connection point [image] on the other entity type.


Indicate a relationship, role, or fact between object types (ORM diagram)

  1. Drag a predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) from the ORM Diagram stencil onto the drawing page.

Use a predicate shape that contains enough role boxes to relate all of the object types (entity shapes) involved in the relationship. For example, use a Ternary shape to indicate relationships among three entities.

  2. Drag a Role Connector shape from the ORM Diagram stencil onto the drawing page.
  3. Glue the begin point [image] of the Role Connector shape to a connection point [image] on an object type (entity shape) for which you want to define a relationship.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  4. Glue the end point [image] of the Role Connector shape to the appropriate role box on the predicate shape (from step 1).
  5. Double-click the predicate shape. Place the insertion point between ellipses (or placeholders), and then type a name for the role an entity type plays.
  6. Repeat steps 2–5 for each entity for which you want to define a relationship.


Indicate a relationship, role, or reference between an entity type and a value type (ORM diagram)

  1. Drag the Role Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the begin point [image] of the Role Connector shape to a connection point [image] on an entity type (entity shape) for which you want to define a relationship.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Drag a Binary or Vertical Binary shape from the ORM Diagram stencil onto the drawing page.
  4. Glue the end point [image] of the Role Connector shape to the end of the Binary or Vertical Binary shape.
  5. Double-click the Binary shape to edit the text. Place the insertion point between ellipses or placeholders, and then type a name for the role an entity plays.

Click to show or hide information. Tip

To move the ellipses and names on a Vertical Binary shape to the other side of the shape, right-click the shape, point to Shape, and then click Flip Horizontal.


Indicate a nested object type by creating an objectified predicate (ORM diagram)

  1. On the Standard toolbar, click the Rectangle tool [image].
  2. Draw a rectangle around the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to identify as an objectified predicate.
  3. Right-click the rectangle, point to Shape, and click Send To Back.
  4. With the rectangle still selected, on the Format menu, click Corner Rounding, click the third option on the top row, and then click OK.


About ORM notation

Click to show or hide information. Object types (entities)

Use an Entity shape to represent an object type in ORM notation (that is, real-world objects). An Entity shape consists of an ellipse with a solid outline.

Name each entity type, and identify how it is referenced (for example, by name or code). For example, if Employee is the entity type's name, you can reference an employee by employee number, which is a code, or by employee name.

Click to show or hide information. Values

Value types represent the strings, numbers, and so on that will actually be stored in a database.

Use a Value shape to represent a value in ORM notation. A Value shape consists of an ellipse with a dashed outline.

Click to show or hide information. Subtyping

Use a Subtype connector to indicate that one entity type is a subtype of another. Connect the two entity types with the Subtype connector, with the arrowhead pointing to the entity from the subtype entity type.

Click to show or hide information. Relationships, roles, facts, and references

In ORM, relationships between entity types (also called facts), and relationships between entity types and value types (also called references) are represented by predicates that contain one or more roles.

Predicates are displayed as a sequence of one or more role boxes. The ORM Diagram stencil in Microsoft Visio includes five predicate shapes (Unary, Binary, Vertical Binary, Ternary, and Quaternary) that include different numbers of role boxes. The predicate shape you use depends on the number of roles. Binary relationships (indicating a relationship between two objects) are the most commonly used.

Use the Binary predicate shape to indicate a relationship or role between an entity and a value.

Binary predicate shape

Use the Ternary predicate shape to indicate relationships among three entities.

Ternary predicate shape

Click to show or hide information. Nested objects or objectified predicates

In ORM, you can treat relationships between objects as objects themselves.

Place a frame with rounded corners around the appropriate predicate to indicate nested objects.

Click to show or hide information. Mandatory role constraints

When a role is mandatory, every member of the current population of the object type must play the role. A mandatory role indicates that no null values are allowed for the given relationship.

Use the Mand. Role Connector shape to indicate a mandatory role constraint.

Click to show or hide information. Uniqueness constraints

Place double-headed arrows above or below role boxes on predicate shapes (Unary, Binary, Vertical Binary, Ternary, and Quaternary) to indicate a uniqueness constraint.

Click to show or hide information. Frequency constraints

To indicate that each instance of a role occurs exactly n times, place the number n beside the role.

Click to show or hide information. Set comparison and equality constraints

Connect role boxes on n-ary predicates with arrows to indicate a subset or equality constraint.

Click to show or hide information. Ring constraints

Ring constraints apply when the same object type plays two roles in a predicate.

Place a ring-shaped symbol above a role box to indicate a ring constraint. Add a two-letter abbreviation beside the symbol to indicate a constraint type. For example, use "ir" to indicate an irreflexive constraint or "as" to indicate an asymmetric constraint.

Click to show or hide information. External constraints

Connect one of the external constraint shapes to the role that the constraint affects to indicate an external constraint.

External uniqueness constraint


Indicate a role constraint (ORM diagram)

Click to show or hide information. Indicate a mandatory role constraint

  1. Drag the Mand. Role Connector shape from the ORM Diagram stencil onto the drawing page.
  2. Glue the begin point with the black circle [image] to a connection point [image] on an object (entity shape).

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  3. Glue the end point [image] of the Mand. Role Connector shape to a predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary).

Click to show or hide information. Indicate a uniqueness constraint

  1. Drag the Uniqueness Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape directly above or below the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to constrain.
  3. Drag one of the endpoints ( [image] or [image]) so that the arrow stretches across the appropriate role box on the predicate shape.

Click to show or hide information. Indicate a frequency constraint

  1. Drag the Frequency Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) you want to constrain.
  3. With the shape selected, type the frequency you want.

Click to show or hide information. Indicate a set comparison or equality constraint

  1. Drag the Subset Constraint or Equality Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape between the predicate shapes (Unary, Binary, Vertical Binary, Ternary, or Quaternary) with roles you want to constrain.
  3. Glue the begin point [image] of the Subset Constraint or Equality Constraint shape to a connection point [image] on the appropriate role box on the predicate shape.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  4. Glue the end point [image] of the Subset Constraint or Equality Constraint shape to the appropriate role box of the other predicate shape.

Click to show or hide information. Indicate a ring constraint

  1. Drag the Ring Constraint shape from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary) containing the two roles you want to constrain.
  3. Do one of the following:
  • If the two roles are part of a longer predicate, glue each endpoint ( [image] and [image]) of the Ring Constraint shape to one of the roles on the predicate shape.
  • If the two roles are a binary predicate, select the Ring Constraint shape, and then on the Format menu, click Line, in the Pattern list, click None, and then click OK.
  4. Right-click the Ring Constraint shape, and then click the type of ring constraint you want.

Click to show or hide information. Indicate an external constraint

  1. Drag an external constraint shape (Ext. Freq. Constraint, Ext. P Constraint, Ext. Mand. Constraint, or Ext. Uniq. Constraint) from the ORM Diagram stencil onto the drawing page.
  2. Place the shape near the predicate shapes representing the roles you want to constrain.
  3. From the ORM Diagram stencil, drag a Constraint Connector shape onto the drawing page.
  4. Glue the begin point [image] of the constraint connector shape to a connection point [image] on the external constraint shape.

The begin point turns red, indicating that the connector is glued to the shape. You can move the glued shapes without breaking the connection.

  5. Glue the end point [image] of the constraint connector shape to the appropriate role box on the predicate shape (Unary, Binary, Vertical Binary, Ternary, or Quaternary).
  6. To change the frequency for the external constraint shape (Ext. Freq. Constraint, Ext. P Constraint, Ext. Mand. Constraint, or Ext. Uniq. Constraint), select the shape, and then type the frequency you want.